<?php
include "includes/ui.php";

echo headerHTML("account","ชำระเงิน");
?> 
<div id="popup_payment_data" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">

        <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h3 id="myModalLabel"><i class="icon-cog"></i> ระบุวันชำระค่าเทอม</h3>
        </div>
	<form class="form-horizontal" id='frmInvoice' style='margin-bottom:0px;' method="POST">
		<input type='hidden' name='sid' id='sid' value=''/>
		<input type='hidden' name='y' id='y' value=''/>
		<input type='hidden' name='t' id='t' value=''/>
        <div class="modal-body">
			<div class="control-group">
					<label class="control-label" for="inputName"><i class="icon-double-angle-right"></i> วันที่ชำระ</label>
					<div class="controls">
						 <div class="input-append date btndate"   data-date="12-02-2012"  data-date-format="dd/mm/yyyy">
							<input class="span1" style="width:100px !important;" id='txtPayDate' name='txtPayDate' size="16" type="text" value='<?php echo $curr;?>'  readonly="">
							<span class="add-on"><i class="icon-calendar"></i></span>
						</div>
					</div>
			</div>
        </div>
        <div class="modal-footer">
			<button type='button' class="btn btn-primary" id="btnSavePaymentDate">บันทึก</button>
			<button class="btn" data-dismiss="modal" aria-hidden="true">ยกเลิก</button>
        </div>
	</form>
</div> 
 <div id="popupSave" class="modal hide fade" style="width:350px;top:35% !important;margin-left:-180px;" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	<form class="form-horizontal" style="margin-bottom:0px;" method="POST" id='frmSlip'>
		<input type='hidden' name='m_term_id' id='m_term_id' value=''/>
		<input type='hidden' name='m_no' id='m_no' value=''/>
    <div class="modal-header" style='padding-top:20px;padding-bottom:25px;'>
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
        <h3 id="myModalLabel" style="color:#72a9c9;"><img src='img/info1.png' width='24px'/> คุณต้องการชำระเงิน ?</h3>
    </div>
  
    <div class="modal-footer center" style="text-align:center !important;padding-top:15px;padding-bottom:15px;">
        <button type='button'  class="btn btn-primary" id="btnSaveStock">ตกลง</button>
        <button class="btn" data-dismiss="modal" aria-hidden="true">ยกเลิก</button>
    </div>
 </form>
</div> 
<!-- Course -->
<div id="popup_course" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" >
	<div class="modal-header">
		<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
		<h3 id="myModalLabel"><i class="icon-usd"></i> รายการคอร์สเรียนพิเศษ </h3>
	  </div>	
		<form class="form-horizontal" style="margin-bottom:0px;" method="POST" id='frmPaymentSlip'>
		<input type='hidden' name='m_term_id' id='m_term_id' value=''/>
		<input type='hidden' name='m_no' id='m_no' value=''/>
       
	   <div class="modal-body">
			 
				<div class="control-group">
					<!-- Add News: WYSIWYG Edior -->
					<table class="table" id='tb_course_detail' style='width:100% !important;'>
						<thead>
							<tr >
							<th style='color:#333 !important;width:50px;'>#</th>
							<th style='color:#333 !important;width:0px !important;'></th>
							<th style='color:#333 !important;width:0px !important;'></th>
							<th style='color:#333 !important;width:0px !important;'></th>
							<th style='color:#333 !important;' class='text-center'>คอร์สเรียน</th>
							<th style='color:#333 !important;width:100px !important;' class="text-center">ค่าเรียน</th>
							<th style='color:#333 !important;width:120px !important;' class="text-center">ชำระ</th>
							</tr>
						</thead>
						<tbody>

						</tbody>
					</table>
				</div>
				<div class="control-group">
					<label class="control-label" for="inputName"><i class="icon-double-angle-right"></i><b> ยอดชำระรวม</b></label>
					<div class="controls">
						<input type="text" id="txtTotalCourse_PayAmt" style='color:red;' class="span2 text-right txtamt" required maxlength="10" disabled >
					</div>
				</div>
                <!-- / Add News: WYSIWYG Edior -->
            </div>
			 
       
		
		<div class="modal-footer">
			<button type='button' class="btn btn-primary" id="btnPayCourseConfirm">ชำระเงิน</button>
			<button class="btn" data-dismiss="modal" aria-hidden="true">ยกเลิก</button>
        </div>
     
		</form>
  
</div>
<!-- Other Payment -->
<div id="popup_payment" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" >

        <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h3 id="myModalLabel"><i class="icon-usd"></i> รายการชำระเงิน </h3>
        </div>
	<form class="form-horizontal" style="margin-bottom:0px;" method="POST" id='frmPaymentOther'>
		<input type='hidden' name='m_term_id' id='slip_m_term_id' value=''/>
		<input type='hidden' name='m_no' id='slip_m_no' value=''/>
        <div class="modal-body">
				<div class="control-group">
					<label class="control-label" for="inputName"><i class="icon-double-angle-right"></i> <span id='payTitle'><span></label>
					<div class="controls">
						<input type="text" id="txtTerm_Remain_Amt"  maxlength="10" readonly class="span2 text-right txtamt" style='color:red;background-color:#fafdd6;' />
					</div>
				</div>
			 
				<div class="control-group">
					<label class="control-label" for="inputName"><i class="icon-double-angle-right"></i> ต้องการชำระ</label>
					<div class="controls">
						<input type="text" id="txtTerm_PayAmt" class="span2 text-right txtamt" required maxlength="10" >
					</div>
				</div>
        </div>
		<div class="modal-footer">
			<button type='button' class="btn btn-primary" id="btnPayConfirm">ชำระเงิน</button>
			<button class="btn" data-dismiss="modal" aria-hidden="true">ยกเลิก</button>
        </div>
     
 </form>
</div>

<div id="popup_Add_list" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" >

        <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h3 id="myModalLabel"><i class="icon-usd"></i> เพิ่มรายการ </h3>
        </div>
	<form class="form-horizontal" style="margin-bottom:0px;" method="POST" id='frmPaymentOther'>
		<input type='hidden' name='m_term_id' id='slip_m_term_id' value=''/>
		<input type='hidden' name='m_no' id='slip_m_no' value=''/>
        <div class="modal-body">
				 
				<div class="control-group">
					<label class="control-label" for="inputName"><i class="icon-double-angle-right"></i> รายการ</label>
					<div class="controls">
						 <select id='cboFeeType' name='cboFeeType' style='width:250px;'></select>
					</div>
				</div>
					<div class="control-group">
					<label class="control-label" for="inputName"><i class="icon-double-angle-right"></i> จำนวนเงิน</label>
					<div class="controls">
						  <input type="text" id="txtListAmount" class="span2 text-right txtamt" required maxlength="8" >
					</div>
				</div>
				
        </div>
		<div class="modal-footer">
			<button type='button' class="btn btn-primary" id="btnConfirmAddList">ชำระเงิน</button>
			<button class="btn" data-dismiss="modal" aria-hidden="true">ยกเลิก</button>
        </div>
     
 </form>
</div>
<!-- end -->

<div id="popup" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="margin-left:-360px;width:800px;">

        <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h3 id="myModalLabel"><i class="icon-search"></i> ค้นหานักเรียน </h3>
        </div>
	<form class="form-horizontal" style="margin-bottom:0px;">
        <div class="modal-body">

			<div class="control-group">
					<label class="control-label" for="inputName" style='font-weight:bold;width:100px !important;'><i class="icon-double-angle-right"></i> รหัสประจำตัว </label>
					<div class="controls" style='margin-left:100px !important;'>
						  &nbsp; <input type="text" id="txtCode_S"   class='span2'  maxlength="15" />
						  
						  &nbsp;<span class="help-inline" style="font-weight:bold;margin-left:50px;"> ชื่อนักเรียน</span>
						  &nbsp;<input type="text" id="txtName_S"   class='span2'  maxlength="50" />
					</div>
			</div>

			 <div class="control-group">
					<label class="control-label" for="inputName" style='font-weight:bold;margin-top:0px;padding-top:0px;width:100px !important;'><i class="icon-double-angle-right"></i> ระดับชั้น</label>
					<div class="controls" style='margin-left:100px !important;'>
							<select class="no-margin" id='cboClass_Search'   style="width:150px !important;">
									 
							</select>
							<select class="no-margin" id='cboRoom_Search'  style="width:70px !important;">
									 
							</select> 
							<button class="btn btn-inverse" style='margin-left:30px;height:30px;' type='button' rel="tooltip" title=""  id="btnSearch"  data-original-title="ค้นหาข้อมูล">
							<i class="icon-search"></i></button> 
					</div>
			</div>
			 <div class="well no-padding">
				 <table class="table" id='tb_student' style='width:100% !important;'>
                    <thead>
                        <tr>
                            <th style='color:#333 !important;width:30px !important;'>#</th>
                            <th style='color:#333 !important;width:0px !important;'></th>
							<th style='color:#333 !important;width:120px !important;' class='center'>รหัส</th>
                            <th style='color:#333 !important;' class='center'>ชื่อ-นักเรียน</th>
                            <th style='color:#333 !important;width:150px !important;'>ระดับชั้น / ห้อง</th>
                            <th style='color:#333 !important;width:40px !important;'>เลือก</th>
                        </tr>
                    </thead>
                    <tbody>

                    </tbody>
                </table>
			 </div>
			
        </div>
		 
     
 </form>
</div> 

<div id="popup_stock_detail" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="width:600px;">

        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h3 id="myModalLabel"><i class="icon-search"></i> รายละเอียดพัสดุ</h3>
        </div>
	<form class="form-horizontal" style="margin-bottom:0px;">
        <div class="modal-body">

			 <div class="well no-padding">
				 <table class="table" id='tb_stock_history_detail' style='width:100% !important;'>
                    <thead>
                        <tr>
                            <th style='color:#333 !important;width:30px !important;'>#</th>
							<th style='color:#333 !important;width:80px !important;' class='text-center'>รหัส</th>
							<th style='color:#333 !important;' class='text-center'>รายการพัสดุ</th>
							<th style='color:#333 !important;width:100px !important;' class='text-center'>จำนวน</th>
                            <th style='color:#333 !important;width:100px !important;' class='text-center'>จำนวนเงิน</th>
                        </tr>
                    </thead>
                    <tbody>

                    </tbody>
                </table>
			 </div>
        </div>
		 <div class="modal-footer">
			<button class="btn" data-dismiss="modal" aria-hidden="true" id='btnClosePaymentDetail'>ปิด</button>
        </div>
     
 </form>
</div> 
<div id="popup_payment_detail" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" >

        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h3 id="myModalLabel"><i class="icon-search"></i> รายละเอียดการชำระเงิน <span id='slip_no'></span> </h3>
        </div>
	<form class="form-horizontal" style="margin-bottom:0px;">
        <div class="modal-body">

			 <div class="well no-padding">
				 <table class="table" id='tb_payment_detail' style='width:100% !important;'>
                    <thead>
                        <tr>
                            <th style='color:#333 !important;width:30px !important;'>#</th>
							<th style='color:#333 !important;' class='text-center'>รายการชำระ</th>
                            <th style='color:#333 !important;width:150px !important;' class='text-center'>จำนวนเงิน</th>
                        </tr>
                    </thead>
                    <tbody>

                    </tbody>
                </table>
			 </div>
        </div>
		 <div class="modal-footer">
			<button class="btn" data-dismiss="modal" aria-hidden="true" id='btnClosePaymentDetail'>ปิด</button>
        </div>
     
 </form>
</div> 

<!-- Live Stats -->
<div class="row-fluid" >

    <!-- Pie: Box -->
    <div class="span12">

        <!--  : Top Bar -->
        <div class="top-bar">
            <h3><i class="icon-user"></i> ข้อมูลนักเรียน</h3>
			   <div class='tmp' style='float:right'>
                  <a href="#popup" data-toggle="modal">
						<button class="btn btn-warning"  type='button' style='height:30px;' tooltip="Add">ค้นหานักเรียน</button>
				  </a>
				</div>
        </div>
        <!-- /  : Top Bar -->

		<div class="well no-padding" >
		 
					  <form class="form-horizontal">
					  <div class="control-group" >
							<label class="control-label"  for="inputName">รหัสนักเรียน</label>
							<div class="controls" style='margin-left:90px;'>
								<input type="text" id="txtCode" class="span1"  style='width:100px !important;background-color:#fafdd6;' placeholder="">
								 &nbsp;<span class="help-inline" style="font-weight:bold;margin-left:40px;">ชื่อ - นามสกุล</span>
								&nbsp;&nbsp;<input type="text" id="txtName" readonly style='background-color:#fafdd6;' class="span4" style='' placeholder="">
								 &nbsp;<span class="help-inline" style="font-weight:bold;margin-left:30px;">ระดับชั้น / ห้อง</span>
								 &nbsp;<input type="text" id="txtClass" readonly style='background-color:#fafdd6;' class="span2">
								 
								 
							</div>
								
					 </div>
				 
					</form>
 
		</div>

    </div>
    <!-- / Pie -->

</div>
<div class="row-fluid">
	<div class="span12">
	   <!--  : Top Bar -->
        <div class="top-bar" style="padding-left: 0px;">
		<ul class="tab-container">
		  <li class="active"><a href="#tab-pay1"><i class="icon-folder-close-alt"></i> ค้างชำระ</a></li>
		  <li class=""><a href="#tab-pay2"><i class="icon-usd"></i> ซื้อสินค้า</a></li>
		  <li class=""><a href="#tab-history"><i class="icon-bookmark-empty"></i> ชำระแล้ว</a></li>
		  <li><a href="#tab-stock"><i class=" icon-circle-blank"></i> ชำระแล้ว (Stock)</a></li>
		</ul>
		 <div class='tmp' style='float:right'>
			<a href="#popup_Add_list" data-toggle="modal"  ><button class="btn"  style='width:120px;' id='btnAddList' tooltip="Add">เพิ่มรายการ</button></a>
		</div>
        </div>
		
        <!-- /  : Top Bar -->
        <!-- Pie: Content -->
       <div class="well no-padding tab-content">
	   <div class="tab-pane" id="tab-pay2">
			<div class="span12">
				 <form class="form-horizontal" style="margin-bottom:0px !important;">
				<div class="control-group">
					<label class="control-label" for="inputName"><i class="icon-angle-right"></i>รหัสสินค้า</label>
					<div class="controls" style='margin-left:100px;'>
						<input type='text'  id='txtProductCode' class="span2">
						&nbsp;&nbsp;&nbsp;&nbsp;
						<span class="help-inline" style="font-weight:bold;"><i class="icon-angle-right"></i>รายการสินค้า</span>
						&nbsp;&nbsp;
						<input type='text'  placeholder=""  id='txtProduct' class="span4">
						&nbsp;&nbsp;
						<span class="help-inline" style="font-weight:bold;"><i class="icon-angle-right"></i>จำนวน</span>
						&nbsp;&nbsp;
						<input type="text" id="txtAmt" value="0" class="span1 text-right txtamt" maxlength="3" />
							<button class="btn btn-primary" type='button' id='btnAddProduct' type="button">เพิ่ม!</button>
						 
						
					</div>
				</div>
				</form>
			</div>
			 <table class="table" id='tb_stock' style='width:100% !important;'>
                <thead style='border-top:1px solid #c2c2c2;border-bottom:1px solid #c2c2c2;'> 
                    <tr >
                        <th style='color:#333 !important;width:30px !important;' class='text-center'>#</th>
						<th style='color:#333 !important;width:0px !important;'></th>
						<th style='color:#333 !important;width:120px !important;' class="text-center">รหัสสินค้า</th>
						<th style='color:#333 !important;' class="text-center">รายการสินค้า</th>
                        <th style='color:#333 !important;width:120px !important;' class='text-center'>จำนวน</th>
						<th style='color:#333 !important;width:120px !important;' class='text-center'>ราคา</th>
						<th style='color:#333 !important;width:120px !important;' class='text-center'>จำนวนเงิน</th>
						<th style='color:#333 !important;width:50px !important;'  class="text-center">ลบ </th>
                    </tr>
                </thead>
                <tbody>
                    
				</tbody>
				 
			</table>
			 <div class="control-group" >
				<label class="control-label"  for="inputName" style='padding-top:5px;color:Blue;'><i class="icon-chevron-sign-right"></i>จำนวนเงินที่ต้องชำระ :</label>
				<div class="controls">
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" id="txtTotalStockAmt" style='color:red;'  placeholder="1" value="0" disabled class="span2 text-right">
					&nbsp;&nbsp;&nbsp;
					<a href='#popupSave' data-toggle="modal"><button class="btn btn-danger" style='margin-bottom:10px;' id='btnPaymentStock'>ชำระเงิน</button></a>
				</div>
			 </div>
	   </div>
			<div class="tab-pane active" id="tab-pay1">
				<table class="table" id="term_payment"  style='width:100% !important;'>
                <thead style='border-top:1px solid #c2c2c2;border-bottom:1px solid #c2c2c2;'> 
                    <tr >
                        <th style='color:#333 !important;width:30px !important;'>#</th>
						<th style='color:#333 !important;width:0px !important;' class="text-center">0</th>
						<th style='color:#333 !important;width:80px !important;' class="text-center">ปี</th>
						<th style='color:#333 !important;width:90px !important;' class="text-center">ภาคเรียน</th>
                        <th style='color:#333 !important;' class='text-center'>รายการชำระเงิน</th>
						<th style='color:#333 !important;width:120px !important;' class='text-center'>จำนวนเงิน</th>
						<th style='color:#333 !important;width:120px !important;' class='text-center'>ชำระแล้ว</th>
						<th style='color:#333 !important;width:120px !important;' class='text-center'>ค้างชำระ</th>
						<th style='color:#333 !important;width:0px !important;' class='text-center'></th>
						<th style='color:#333 !important;width:90px !important;' class="text-center">ชำระ </th>
						<th style='color:#333 !important;width:70px !important;' class="text-center">ยกเลิก </th>
                    </tr>
                </thead>
                <tbody>
                      
                </tbody>
				</table>
				<div class="control-group" >
					<label class="control-label"  for="inputName" style='padding-top:5px;color:Blue;'><i class="icon-chevron-sign-right"></i>รวมเป็นเงินค้างชำระทั้งสิ้น :</label>
						<div class="controls">
								&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					&nbsp;&nbsp;&nbsp;<input type="text" id="txtRemailTotal"  style='color:red;' class='text-right span2' value="0" disabled >
								<a href='#popupSave' data-toggle="modal"><button class="btn btn-danger" style='margin-bottom:10px;height:30px;' id='btnPaymentTerm'>ชำระเงินทั้งหมด</button></a>
							</div>
				</div>
			</div>
          
			
			
			<div class="tab-pane" id="tab-history">
			<table class="table" id='term_history'  style='width:100% !important;'>
                <thead style='border-top:1px solid #c2c2c2;border-bottom:1px solid #c2c2c2;'> 
                    <tr >
                        <th style='color:#333 !important;width:40px;'>#</th>
						<th style='color:#333 !important;width:150px;' class="text-center">ปีการศึกษา</th>
						<th style='color:#333 !important;width:120px;' class="text-center">ภาคเรียน</th>
						<th style='color:#333 !important;width:150px;' class='text-center'>เลขที่ใบเสร็จ</th>
                        <th style='color:#333 !important;width:150px;' class='text-center'>วันที่รับใบเสร็จ</th>
						<th style='color:#333 !important;width;' class='text-center'>ผู้รับเงิน</th>
						<th style='color:#333 !important;width:150px;' class='text-center'>จำนวนเงิน</th>
						<th style='color:#333 !important;width:100px;' class='text-center'>รายละเอียด</th>
                    </tr>
                </thead>
                <tbody>
                   
				 
                   
                </tbody>
				 
            </table>
			</div>
			
			<div class="tab-pane" id="tab-stock">
			<table class="table" id='stock_history' style='width:100% !important;' >
                <thead style='border-top:1px solid #c2c2c2;border-bottom:1px solid #c2c2c2;'> 
                    <tr >
                        <th style='color:#333 !important;width:30px !important;'>#</th>
						<th style='color:#333 !important;'></th>
						<th style='color:#333 !important;width:120px !important;' class="text-center">เลขที่ใบเสร็จ</th>
						<th style='color:#333 !important;width:110px !important;' class="text-center">ลงวันที่</th>
						<th style='color:#333 !important;width:100px !important;' class="text-center">ปีการศึกษา</th>
						<th style='color:#333 !important;width:100px !important;' class="text-center">ภาคเรียน</th>
						<th style='color:#333 !important;width:150px !important;' class='text-center'>จำนวนรายการ</th>
						<th style='color:#333 !important;width:150px !important;' class='text-center'>จำนวนเงิน</th>
						<th style='color:#333 !important;' class='text-center'>ผู้รับเงิน</th>
						<th style='color:#333 !important;width:120px !important;' class='text-center'>รายละเอียด</th>
                    </tr>
                </thead>
                <tbody>
                   
                     
                </tbody>
				 
            </table>
			</div>
        <!-- / Pie: Content -->
	</div>
</div>
<!-- / Live Stats -->

<?php
echo footerHTML();
?>

<!-- Javascript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src='js/jquery.hotkeys.js'></script>
<!--script src='js/fullcalendar.min.js'></script-->
<script src="js/jquery-ui-1.10.2.custom.min.js"></script>
<script src="js/jquery.pajinate.js"></script>
<!--script src="js/jquery.prism.min.js"></script-->
<script src="js/jquery.dataTables.js"></script>

<script src="js/jquery.flot.resize.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/bootstrap-wysiwyg.js"></script>
<script src="js/bootstrap-typeahead.js"></script>
<script src="js/jquery.easing.min.js"></script>
<script src="js/jquery.chosen.min.js"></script>
<script src="js/avocado-custom.js"></script>
<script src="js/jqBootstrapValidation.js"></script>
<script src="js/bootstrap-datepicker.js"></script>
<script src="js/avocado-custom.js"></script>
<script src="js/myScript/js_pos.js"></script>

</html>